Closed Bug 1674610 Opened 5 years ago Closed 4 years ago

nsTableRowGroupFrame.cpp: do not use 'else' after 'break'

Categories

(Core :: Layout: Tables, task)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: Sylvestre, Assigned: baka)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=C++])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1669833 +++

Filling as a good first bug to learn workflows.

do not use 'else' after 'break':
https://searchfox.org/mozilla-central/source/layout/tables/nsTableRowGroupFrame.cpp#1335-1347

As the change is trivial, it is just to learn how to contribute to Firefox.

Found by http://clang.llvm.org/extra/clang-tidy/checks/readability-else-after-return.html

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Component: General → Layout: Tables

Hey, first-time contributor here. I had a look at the referenced lines of code. Will removing else with its parantheses, but keeping the code block inside fix the issue? Like this:

...
      break;
    }  // if (rowRect.YMost() > availHeight)
    // removed else {
    aDesiredSize.Height() = rowRect.YMost();
    prevRowFrame = rowFrame;
    // see if there is a page break after the row
    nsTableRowFrame* nextRow = rowFrame->GetNextRow();
    if (nextRow && nsTableFrame::PageBreakAfter(rowFrame, nextRow)) {
      PushChildren(nextRow, rowFrame);
      aStatus.Reset();
      aStatus.SetIncomplete();
      break;
    }
    // removed } from else statement
...

How go about testing these trivial changes? As the code doesn't break from this mistake, it's hard for me to analyze whether it's fixed.

Sounds good, but remove the " // removed else {". we have a VCS to keep track of these changes.

For testing, just build it :)

Assignee: nobody → akshat.dixit71
Status: NEW → ASSIGNED
Attachment #9194758 - Attachment description: Bug 1674610 - Fixed. r?emilio → Bug 1674610 - Fixed code to make it follow LLVM standards. r?emilio
Attachment #9194758 - Attachment description: Bug 1674610 - Fixed code to make it follow LLVM standards. r?emilio → Bug 1674610 - Remove a useless else after break in nsTableRowGroupFrame.cpp. r?emilio
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8a273e648899 Remove a useless else after break in nsTableRowGroupFrame.cpp. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: